package cn.cloud9;

public class Demo5GetSumByFor {

    /**
     * https://www.bilibili.com/video/BV18J411W7cE?p=41
     * 使用For循环求和
     * @param args
     */
    public static void main(String[] args) {
        int sum = 0;
        final int BEGIN = 1;
        final int END = 5;
        for (int i = BEGIN; i <= END ; i++) sum += i;
        System.out.println("从" + BEGIN + "加到" + END + " 合计值：" + sum);
    }
}
